<!-- 拼团 -->
<template>
	<view class="pinTuanContent" :style="{backgroundImage:`linear-gradient(to top, rgba(255,0,0,0) 334rpx, ${bgjb})`}">
		<view class="pinTuanTitle">
			<view class="pinlogo">
				<view class="logoIMgs">
					<image :src="staticImgUrl + 'pingtuanzhuanqu.png'" mode=""></image>
				</view>
				<view class="pintitles">爱拼才会赢</view>
			</view>
			<view class="text-nav-right mopingtext" @click="tomoreSpell">
				更多拼团
				<text class="cuIcon-right"></text>
			</view>
		</view>
		<scroll-view class="scroll-pintuan" :scroll-x="true" :scroll-with-animation="true"
			@scrolltolower="scrolltolowerpintuan">
			<view class="pintuanItemContent">
				<view class="pintuanItem" v-for="(item,index) in goodsList" :key="index" @click="toSpell(item)">
					<view class="itemImage">
						<image :src="item.sku_image" mode="" :lazy-load="true"></image>
					</view>
					<view class="itemTitles">{{item.sku_name}}</view>
					<view class="itemTrs">{{item.pintuan_num}}人团</view>
					<view class="itemprices">￥<text class="prices">{{item.pintuan_price}}</text></view>
					<!-- <view><text class="pricesTwos">￥{{item.price}}</text></view> -->
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		name: '',
		data() {
			return {
				goodsList: [],
				page: 1,
				page_size: 10
			};
		},
		props: {
			bgjb: {
				type: String,
				default: ''
			},
			site_id:{
				type: [Number, String],
				default: 0
			}

		},
		methods: {
			scrolltolowerpintuan(e) {
				// console.log("e",e)
				this.page++
				this.init()
			},
			init() {
				let objs = {
					page: this.page,
					page_size: this.page_size,
					site_id:this.site_id
				}
				this.$Apis.pintuangoodspage(objs).then(res => {
					if (res.list.length > 0) {
						if (this.page == 1) {
							this.goodsList = res.list
						} else {
							this.goodsList = this.goodsList.concat(res.list)
						}
					}
				})
			},
			toSpell(val) {
				this.$Router.push({
					path: '/shopPages/goods/pintuandetail',
					query: {
						sku_id: val.id
					}
				});
			},
			tomoreSpell() {
				this.$Router.push({
					path: '/otherpages/pintuan/moreSpell',
					query:{
						site_id:this.site_id
					}
				});
			}
		},
		mounted() {
			this.init();
			// console.log("bgjb", this.bgjb)
		}
	};
</script>

<style lang="scss">
	image {
		width: 100%;
		height: 100%;
	}

	.jbbgs {
		border-top-left-radius: 24rpx;
		border-top-right-radius: 24rpx;
		position: absolute;
		width: 100%;
		height: 160rpx;
		top: 0;
		left: 0;
		z-index: 1;
	}

	.pintuanItemContent {
		display: flex;
		align-items: center;
	}

	.pinTuanContent {
		position: relative;
		width: 690rpx;
		height: 524rpx;
		background: #FFFFFF;
		border-radius: 24rpx;
		margin: 20rpx auto 0 auto;
	}

	.pinTuanTitle {
		width: 92%;
		margin: 0 auto;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding-top: 36rpx;
		padding-bottom: 36rpx;
		z-index: 9;
	}

	.pinlogo {
		display: flex;
	}

	.logoIMgs {
		width: 143rpx;
		height: 35rpx;
	}

	.pintitles {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #999999;
		padding-left: 16rpx;
	}

	.mopingtext {
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FD3B5C;
	}

	.scroll-pintuan {
		width: 92%;
		margin: 0 auto;
	}

	.pintuanItem {
		width: 196rpx;
		margin-right: 22rpx;
	}

	.itemImage {
		width: 196rpx;
		height: 200rpx;
	}

	.itemTitles {
		width: 181rpx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		padding-top: 20rpx;
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
	}

	.itemTrs {
		width: 100rpx;
		height: 50rpx;
		background: #FFD8DE;
		border-radius: 20rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #E94D60;
		text-align: center;
		line-height: 52rpx;
		padding-left: 10rpx;
		padding-right: 10rpx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		margin-top: 10rpx;
		margin-bottom: 24rpx;
	}

	.itemprices {
		font-size: 18rpx;
		font-family: PingFang SC;
		font-weight: 800;
		color: #EA3F49;
	}

	.prices {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 800;
		color: #EA3F49;
	}

	.pricesTwos {
		font-size: 22rpx;
		color: #999999;
		font-style: italic;
		text-decoration: line-through;
		padding-left: 10rpx;
	}
</style>
